		
		* Table 3
		* Nonparametric Treatment Effect Estimates

		
		clear all
		set more off
	
		use "C:\Users\EAsker\Desktop\ABR\data\ABR_final_data"
		
		drop if qrdinc80_b==2|qrdinc80_b==3
		
		****Baseline controls
		replace fam_inc=. if fam_inc==99|fam_inc==97|fam_inc==0
		gen ln_fam_inc=log(fam_inc)
		
		gen miss_mot_hs=1 if mot_hs==.
		replace miss_mot_hs=0 if mot_hs~=.
		replace mot_hs=0 if mot_hs==.
	
		gen miss_fat_hs=1 if fat_hs==.
		replace miss_fat_hs=0 if fat_hs~=.
		replace fat_hs=0 if fat_hs==.
	   
		gen miss_fam_inc=1 if ln_fam_inc==.
		replace miss_fam_inc=0 if ln_fam_inc~=.
		replace ln_fam_inc=0 if ln_fam_inc==.
	
		gen miss_female=1 if female==.
		replace miss_female=0 if female~=.
		replace female=0 if female==.
	    sort  survey wave sch_id
		
		gen miss_not_white=1 if not_white==.
		replace miss_not_white=0 if not_white~=.
		replace not_white=0 if not_white==.
		
		egen m_weight=mean(weight), by(survey wave sch_id) 
	    replace weight=m_weight if (weight==.|weight==0)&m_weight~=0	
		
		gen log_income=log(income)
		
		gen income_0=income
		replace income_0=. if income_0==0
		
		gen pos_income_dummy=.
		replace pos_income_dummy=1 if income>0&income~=.
		replace pos_income_dummy=0 if income==0
		
	** Generating exposure year and quartile 1 interaction variables.
	
	gen yrs_since=year-CSFR_year_BJH
	gen treat=1 if yrs_since~=.
	recode treat .=0
	
	replace yrs_since=0 if yrs_since==.
	
	ta yrs_since
	
	gen tp1_5=1 if yrs_since<=5&yrs_since>=1
	recode tp1_5 .=0
	
	gen tp6_9=1 if yrs_since<=9&yrs_since>=6
	recode tp6_9 .=0
	
	gen tp_10=1 if yrs_since>=10&yrs_since~=.
	recode tp_10 .=0
	
	for x in any tp1_5 tp6_9 tp_10:gen x_q1=x*qr80_1

		
	local controls_civic "miss_mot_hs miss_fat_hs miss_fam_inc miss_not_white miss_female mot_hs fat_hs ln_fam_inc not_white female"
		
	foreach y of varlist high_school post_scndry vltnry_prtcptn vlntry_hours register_vote {
	   	
		************** BHJ
	reghdfe `y'  tp1_5_q1 tp6_9_q1 tp_10_q1 `controls_civic' ///
		if wave==2 , absorb (statexsurvey_quartile quartilexstate quartilexsurvey) ///
		cluster (quartilexstate) 
	
	outreg2 using Table_3.xls, append ctitle(`y') bdec(4) nonotes nocons ///
	keep(tp1_5_q1  tp6_9_q1 tp_10_q1) addtext(Control, YES, State by Survey FE, YES, ///
		Quartile by State FE, YES, Quartile by Survey FE, YES) 
				 
	}
